<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .main{
            display: flex;
            height: 400px;
            justify-content: center;
            align-items: center;
            border: 1px solid black;
        }

        .box{
            width: 300px;
            border: 1px solid black;
        }
    </style>
</head>
<body>
<div class="main">
    <div class="box">未知高度上下左右居中</div>
</div>
</body>
</html>